<template>
  <div>
    <div>--------------------</div>
    <div>子组件2</div>
    <a-input
      placeholder="利用总线传给父组件"
      v-model="name"
      style="width:20%"
    />
    <div><a-button @click="onClick()">使用总线传值</a-button></div>
  </div>
</template>

<script>
export default {
  name: "child2",
  data() {
    return {
      name: ""
    };
  },
  methods: {
    onClick() {
      this.$eventBus.$emit("getName", this.name);
    }
  }
};
</script>

<style></style>
